home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 103
/
Vol 103.iso
/
games
/
scuba.swf
/
scripts
/
frame_18
/
PlaceObject2_117_156
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2010-03-13
|
2KB
|
50 lines
onClipEvent(enterFrame){
if(status == "active" && this._x >= _root.RIGHT_BOUND)
{
if(_root.coral.hitTest(this._x,this._y,true) == true)
{
vSideOfImpact = "undetermined";
vPixelCounter = Number(1);
while(vSideOfImpact == "undetermined")
{
if(_root.coral.hitTest(this._x,Number(this._y + Number(vPixelCounter)),true) == false && Number(this._y + Number(vPixelCounter)) < _root.BOTTOM_BOUND)
{
vSideOfImpact = "top";
vPixelOffset = vPixelCounter + Number(this._height) * 2;
}
else if(_root.coral.hitTest(this._x,Number(this._y - Number(vPixelCounter)),true) == false && _root.TOP_BOUND < Number(this._y - Number(vPixelCounter)))
{
vSideOfImpact = "bottom";
vPixelOffset = vPixelCounter + Number(this._height) * 2;
}
vPixelCounter++;
}
if(vSideOfImpact == "top")
{
setProperty(this, _Y, Number(this._y + Number(vPixelOffset)));
}
else if(vSideOfImpact == "bottom")
{
setProperty(this, _Y, Number(this._y - Number(vPixelOffset)));
}
}
}
else if(status == "active" && this._x < _root.RIGHT_BOUND)
{
if(_root.recruit.diver.hitTest(this._x,this._y,false) == true && hit != true)
{
_root.fnTakeOxygen();
hit = true;
this.gotoAndPlay("takeoxygen");
}
else if(hit == true)
{
if(this._x < _root.LEFT_BOUND)
{
hit = false;
this.gotoAndPlay("loop");
}
}
}
}